home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / PCI.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  8.0 KB  |  315 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        PCI.a
  3. ;
  4. ;    Contains:    PCI Bus Interfaces.
  5. ;
  6. ;    Version:    Technology:    PowerSurge 1.0.2
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__PCI__') = 'UNDEFINED' THEN
  19. __PCI__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
  25.     include 'NameRegistry.a'
  26.     ENDIF
  27.  
  28. ;  Types and structures for accessing the PCI Assigned-Address property.
  29.  
  30.  
  31. kPCIRelocatableSpace            EQU        $80
  32. kPCIPrefetchableSpace            EQU        $40
  33. kPCIAliasedSpace                EQU        $20
  34. kPCIAddressTypeCodeMask            EQU        $03
  35. kPCIConfigSpace                    EQU        0
  36. kPCIIOSpace                        EQU        1
  37. kPCI32BitMemorySpace            EQU        2
  38. kPCI64BitMemorySpace            EQU        3
  39. ; typedef UInt8                         PCIAddressSpaceFlags
  40.  
  41.  
  42. kPCIDeviceNumberMask            EQU        $1F
  43. kPCIFunctionNumberMask            EQU        $07
  44. ; typedef UInt8                         PCIDeviceFunction
  45.  
  46. ; typedef UInt8                         PCIBusNumber
  47.  
  48. ; typedef UInt8                         PCIRegisterNumber
  49.  
  50. PCIAssignedAddress        RECORD 0
  51. addressSpaceFlags         ds.b    1                ; offset: $0 (0)
  52. busNumber                 ds.b    1                ; offset: $1 (1)
  53. deviceFunctionNumber     ds.b    1                ; offset: $2 (2)
  54. registerNumber             ds.b    1                ; offset: $3 (3)
  55. address                     ds        UnsignedWide    ; offset: $4 (4)
  56. size                     ds        UnsignedWide    ; offset: $C (12)
  57. sizeof                     EQU *                    ; size:   $14 (20)
  58.                         ENDR
  59. ; typedef struct PCIAssignedAddress *    PCIAssignedAddressPtr
  60.  
  61.  
  62.     IF TARGET_CPU_68K THEN
  63.         Macro
  64.         _EndianSwap32Bit &Dn
  65.             IF &Dn = '' THEN
  66.                 ROL.W    #8,D0
  67.                 SWAP    D0
  68.                 ROL.W    #8,D0
  69.             ELSE
  70.                 ROL.W    #8,&Dn
  71.                 SWAP    &Dn
  72.                 ROL.W    #8,&Dn
  73.             ENDIF
  74.         Endm
  75.     ELSE
  76.         IMPORT_CFM_FUNCTION    EndianSwap32Bit
  77.     ENDIF
  78.  
  79.     IF TARGET_CPU_68K THEN
  80.         Macro
  81.         _EndianSwap16Bit &Dn
  82.             IF &Dn = '' THEN
  83.                 ROL.W    #8,D0
  84.             ELSE
  85.                 ROL.W    #8,&Dn
  86.             ENDIF
  87.         Endm
  88.     ELSE
  89.         IMPORT_CFM_FUNCTION    EndianSwap16Bit
  90.     ENDIF
  91.  
  92. ;
  93. ; pascal OSErr ExpMgrConfigReadByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 *valuePtr)
  94. ;
  95.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  96.         Macro
  97.         _ExpMgrConfigReadByte
  98.             move.w              #$0620,D0
  99.             dc.w                $AAF3
  100.         EndM
  101.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  102.         IMPORT_CFM_FUNCTION ExpMgrConfigReadByte
  103.     ENDIF
  104.  
  105. ;
  106. ; pascal OSErr ExpMgrConfigReadWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 *valuePtr)
  107. ;
  108.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  109.         Macro
  110.         _ExpMgrConfigReadWord
  111.             move.w              #$0621,D0
  112.             dc.w                $AAF3
  113.         EndM
  114.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  115.         IMPORT_CFM_FUNCTION ExpMgrConfigReadWord
  116.     ENDIF
  117.  
  118. ;
  119. ; pascal OSErr ExpMgrConfigReadLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 *valuePtr)
  120. ;
  121.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  122.         Macro
  123.         _ExpMgrConfigReadLong
  124.             move.w              #$0622,D0
  125.             dc.w                $AAF3
  126.         EndM
  127.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  128.         IMPORT_CFM_FUNCTION ExpMgrConfigReadLong
  129.     ENDIF
  130.  
  131. ;
  132. ; pascal OSErr ExpMgrConfigWriteByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 value)
  133. ;
  134.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  135.         Macro
  136.         _ExpMgrConfigWriteByte
  137.             move.w              #$0523,D0
  138.             dc.w                $AAF3
  139.         EndM
  140.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  141.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteByte
  142.     ENDIF
  143.  
  144. ;
  145. ; pascal OSErr ExpMgrConfigWriteWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 value)
  146. ;
  147.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  148.         Macro
  149.         _ExpMgrConfigWriteWord
  150.             move.w              #$0524,D0
  151.             dc.w                $AAF3
  152.         EndM
  153.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  154.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteWord
  155.     ENDIF
  156.  
  157. ;
  158. ; pascal OSErr ExpMgrConfigWriteLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 value)
  159. ;
  160.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  161.         Macro
  162.         _ExpMgrConfigWriteLong
  163.             move.w              #$0625,D0
  164.             dc.w                $AAF3
  165.         EndM
  166.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  167.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteLong
  168.     ENDIF
  169.  
  170. ;
  171. ; pascal OSErr ExpMgrIOReadByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 *valuePtr)
  172. ;
  173.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  174.         Macro
  175.         _ExpMgrIOReadByte
  176.             move.w              #$0626,D0
  177.             dc.w                $AAF3
  178.         EndM
  179.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  180.         IMPORT_CFM_FUNCTION ExpMgrIOReadByte
  181.     ENDIF
  182.  
  183. ;
  184. ; pascal OSErr ExpMgrIOReadWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 *valuePtr)
  185. ;
  186.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  187.         Macro
  188.         _ExpMgrIOReadWord
  189.             move.w              #$0627,D0
  190.             dc.w                $AAF3
  191.         EndM
  192.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  193.         IMPORT_CFM_FUNCTION ExpMgrIOReadWord
  194.     ENDIF
  195.  
  196. ;
  197. ; pascal OSErr ExpMgrIOReadLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 *valuePtr)
  198. ;
  199.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  200.         Macro
  201.         _ExpMgrIOReadLong
  202.             move.w              #$0628,D0
  203.             dc.w                $AAF3
  204.         EndM
  205.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  206.         IMPORT_CFM_FUNCTION ExpMgrIOReadLong
  207.     ENDIF
  208.  
  209. ;
  210. ; pascal OSErr ExpMgrIOWriteByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 value)
  211. ;
  212.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  213.         Macro
  214.         _ExpMgrIOWriteByte
  215.             move.w              #$0529,D0
  216.             dc.w                $AAF3
  217.         EndM
  218.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  219.         IMPORT_CFM_FUNCTION ExpMgrIOWriteByte
  220.     ENDIF
  221.  
  222. ;
  223. ; pascal OSErr ExpMgrIOWriteWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 value)
  224. ;
  225.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  226.         Macro
  227.         _ExpMgrIOWriteWord
  228.             move.w              #$052A,D0
  229.             dc.w                $AAF3
  230.         EndM
  231.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  232.         IMPORT_CFM_FUNCTION ExpMgrIOWriteWord
  233.     ENDIF
  234.  
  235. ;
  236. ; pascal OSErr ExpMgrIOWriteLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 value)
  237. ;
  238.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  239.         Macro
  240.         _ExpMgrIOWriteLong
  241.             move.w              #$062B,D0
  242.             dc.w                $AAF3
  243.         EndM
  244.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  245.         IMPORT_CFM_FUNCTION ExpMgrIOWriteLong
  246.     ENDIF
  247.  
  248. ;
  249. ; pascal OSErr ExpMgrInterruptAcknowledgeReadByte(RegEntryIDPtr entry, UInt8 *valuePtr)
  250. ;
  251.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  252.         Macro
  253.         _ExpMgrInterruptAcknowledgeReadByte
  254.             move.w              #$0411,D0
  255.             dc.w                $AAF3
  256.         EndM
  257.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  258.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadByte
  259.     ENDIF
  260.  
  261. ;
  262. ; pascal OSErr ExpMgrInterruptAcknowledgeReadWord(RegEntryIDPtr entry, UInt16 *valuePtr)
  263. ;
  264.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  265.         Macro
  266.         _ExpMgrInterruptAcknowledgeReadWord
  267.             move.w              #$0412,D0
  268.             dc.w                $AAF3
  269.         EndM
  270.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  271.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadWord
  272.     ENDIF
  273.  
  274. ;
  275. ; pascal OSErr ExpMgrInterruptAcknowledgeReadLong(RegEntryIDPtr entry, UInt32 *valuePtr)
  276. ;
  277.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  278.         Macro
  279.         _ExpMgrInterruptAcknowledgeReadLong
  280.             move.w              #$0413,D0
  281.             dc.w                $AAF3
  282.         EndM
  283.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  284.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadLong
  285.     ENDIF
  286.  
  287. ;
  288. ; pascal OSErr ExpMgrSpecialCycleWriteLong(RegEntryIDPtr entry, UInt32 value)
  289. ;
  290.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  291.         Macro
  292.         _ExpMgrSpecialCycleWriteLong
  293.             move.w              #$0419,D0
  294.             dc.w                $AAF3
  295.         EndM
  296.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  297.         IMPORT_CFM_FUNCTION ExpMgrSpecialCycleWriteLong
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal OSErr ExpMgrSpecialCycleBroadcastLong(UInt32 value)
  302. ;
  303.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  304.         Macro
  305.         _ExpMgrSpecialCycleBroadcastLong
  306.             move.w              #$021A,D0
  307.             dc.w                $AAF3
  308.         EndM
  309.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  310.         IMPORT_CFM_FUNCTION ExpMgrSpecialCycleBroadcastLong
  311.     ENDIF
  312.  
  313.     ENDIF ; __PCI__ 
  314.  
  315.